import re

class RegxValidator:
        # 正则表达式模式     
    china_phone_pattern = re.compile(r'^1[3-9]\d{9}$')
    malaysia_phone_pattern = re.compile(r'^(01\d{8,9}|\+60\d{9,10})$')
    email_pattern = re.compile(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$')

    @staticmethod
    def is_china_phone( number):
        """验证中国内地手机号码（11位，去除所有非数字字符）"""
        cleaned = re.sub(r'\D', '', number)  # 去除非数字字符
        return bool(RegxValidator.china_phone_pattern.match(cleaned))

    @staticmethod
    def is_malaysia_phone(number):
        """验证马来西亚手机号码（支持本地和国际格式）"""
        cleaned = re.sub(r'[^0-9+]', '', number)  # 保留数字和加号
        return bool(RegxValidator.malaysia_phone_pattern.match(cleaned))

    @staticmethod
    def is_email(email):
        """验证电子邮箱（去除首尾空格）"""
        return bool(RegxValidator.email_pattern.match(email.strip()))